#ifndef __PLATFORM_LIB_MD5_H__
#define __PLATFORM_LIB_MD5_H__
#ifdef __cplusplus
extern "C"
{
#endif

#include "pf_common.h"

/******************************************************************************************************/

typedef struct pf_md5 pf_md5_t;

/*********************************************************************************************
Function Name:  pf_md5_start
Description  :  Init tbe pf_md5 and return the md5 struct
Inputs       :
Outputs      :  pf_md5_t*       : a initial struct of md5,NULL for error
ErrorCodes   :  PF_ENOMEM       : intial md5 struct error
History      :
---------------------------------------------------------------------------------------------
Author                 Date                          Comments
huyq                   2011-06-23                    create
**********************************************************************************************/
extern pf_md5_t* pf_md5_start(void);

/*********************************************************************************************
Function Name:  pf_md5_append
Description  :  Append data to pf_md5 context
Inputs       :  pf_md5_t*   md5  : the md5 context
                const void* data : the buffer to handle
                uint32_t    len  : the len of the buffer
Outputs      :  int :0 for ok
ErrorCodes   :
History      :
---------------------------------------------------------------------------------------------
Author                 Date                          Comments
huyq                   2011-06-23                    create
**********************************************************************************************/
extern int pf_md5_append(pf_md5_t* md5, const void* data, uint32_t len);

/*********************************************************************************************
Function Name:  pf_md5_finish
Description  :  Finish and get result
Inputs       :  pf_md5_t* md5              : the md5 context
                unsigned char result[16]   : the hex result of the md5
Outputs      :  int                        : 0 for ok
ErrorCodes   :
History      :
---------------------------------------------------------------------------------------------
Author                 Date                          Comments
huyq                   2011-06-23                    create
**********************************************************************************************/
extern int pf_md5_finish(pf_md5_t* md5, unsigned char result[16]);

/******************************************************************************************************/

#ifdef __cplusplus
}
#endif
#endif /* #ifndef __PLATFORM_LIB_MD5_H__ */


